<? 

$deltager = $this->session->userdata('deltager');
$ingame = $this->session->userdata('ingame');
$rollespiller = new rollespiller();
$gm = new gamemaster_model();
$rollespiller->find_pcer($deltager['userid']);
$pcer = $rollespiller->pcer;

if($ingame['ingame_id'] != 0){ //hvis man ikke er gm.
	$rollespiller->find_vaerker();
	$rollespiller->find_admin();
	$rol_ind = $rollespiller->admin_individ;
	$vaerk_ind = $rollespiller->vaerker_individ;
	$rol_gru = $rollespiller->admin_gruppe;
	$vaerk_gru = $rollespiller->vaerker_gruppe;
	$rol_ste = $rollespiller->admin_sted;
	$vaerk_ste = $rollespiller->vaerker_sted;
	$rol_beg = $rollespiller->admin_begivenhed;
	$vaerk_beg = $rollespiller->vaerker_begivenhed;
		//echo "<br>(views>includes/banners/skift_blik.php) rol_ind er "; print_r($rol_ind);
	$admin_individ = $this->sorterings_model->array_sort(array_merge($rol_ind, $vaerk_ind),"navn",SORT_ASC);
		//echo "<br>(views>includes/banners/skift_blik.php) admin_individ er "; print_r($admin_individ);
	$admin_gruppe = $this->sorterings_model->array_sort(array_merge($rol_gru, $vaerk_gru),"navn",SORT_ASC);
	$admin_sted = $this->sorterings_model->array_sort(array_merge($rol_ste, $vaerk_ste),"navn",SORT_ASC);
	$admin_begivenhed = $this->sorterings_model->array_sort(array_merge($rol_beg, $vaerk_beg),"navn",SORT_ASC);
}else{ //hvis man er gm

	$gm->find_kampagne_elementer();
	$admin_individ = $this->sorterings_model->array_sort($gm->kampagne_individ,"navn",SORT_ASC);
		//echo "<br>(views>includes/banners/skift_blik.php) admin_individ er "; print_r($admin_individ);
	$admin_gruppe = $this->sorterings_model->array_sort($gm->kampagne_gruppe,"navn",SORT_ASC);
	$admin_sted = $this->sorterings_model->array_sort($gm->kampagne_sted,"navn",SORT_ASC);
	$admin_begivenhed = $this->sorterings_model->array_sort($gm->kampagne_begivenhed,"navn",SORT_ASC);	
}



$gm->find_kampagner($deltager['userid']);
$kampagner = $gm->kampagner;

$sa = new side_administrator();
$sa->find_side_administratorer();
$side_admin_ider = $sa->side_administratorer_ider;
	//echo "<br>(view>includes/banners/skift_blik) side_admin_ider er "; print_r($side_admin_ider);
$sa_kampagne_id = 30;


?>



		<div id="admin_ark">
			<div class="row-fluid">
				<div class="span6">
<? 
					//tjekker om man er side_administrator
					if(in_array($deltager['userid'],$side_admin_ider)){
						//sætter kampagne til kampagne_aktuel
						$this->load->model('login_model');
						$deltager = $this->session->userdata('deltager');

						$userdata = $this->login_model->get_deltager_data($deltager['username']);
							//echo "<br>(view>includes/banners/skift_blik) userdata er "; print_r($userdata);
						echo "<p class='rubrik'>";
						echo anchor("login/skift_blik/-1/".$userdata['kampagne_aktuel'],"Sideadministrator","class='ink'"); 
						echo "</p>";
					

					}


?>

                <div class="gm_blik">
<h3 class="rubrik">Gamemaster blik</h3>

<?
					if(isset($kampagner)){
						foreach($kampagner as $k){
                            echo "<p>";
							echo anchor("login/skift_blik/0/".$k['kampagne_id'],"Gamemaster i ".$k['kampagne_navn'],"class='ink'"); 
                            echo "</p>";
                        
						}
					}
?>
               	</div>


                <div class="pc_blik">
<h3 class="rubrik">Player-Character blik</h3>
<?
					if(isset($pcer)){
						foreach($pcer as $p){
							echo anchor("login/skift_blik/".$p['pc_id']."/".$p['kampagne_id'],"<p>".$p['pc_navn']." i ".$p['kampagne_navn']."</p>","class='ink'"); 
						}
					}
?>
                </div>

			</div>

			<div class="span6">
			
                <div class="npc_blik">
<h3 class="rubrik">Non-Player-Character blik</h3>
					<?
					if(!empty($admin_individ)){
						foreach($admin_individ as $ind){
							echo anchor("login/skift_blik/".$ind['id']."/".$ingame['kampagne_id'], "<p>".$ind['navn']."</p>","class='ink'");
						}
					}
					?>

                </div>

			</div>




            </div>
		</div>





		




	
